<template>
  <div id="app">
    <!-- 顶部栏开始-->
    <mt-header title="信息管理">
      <router-link to="/" slot="left">
        <mt-button icon="back">返回</mt-button>
      </router-link>
      <mt-button icon="more" slot="right"></mt-button>
    </mt-header>
    <!-- 顶部栏结束-->

    <!-- 路由组件开始-->
    <router-view/>
    <!-- 路由组件结束-->

    <!-- 底部栏开始-->
    <mt-tabbar v-model="selected">
      <mt-tab-item id="home">
        <img slot="icon" src="./assets/tabBarImg/index1.png">
        首页
      </mt-tab-item>
      <mt-tab-item id="news">
        <img slot="icon" src="./assets/tabBarImg/news1.png">
        新闻
      </mt-tab-item>
      <mt-tab-item id="shop">
        <img slot="icon" src="./assets/tabBarImg/cart1.png">
        购物车
      </mt-tab-item>
      <mt-tab-item id="my">
        <img slot="icon" src="./assets/tabBarImg/my1.png">
        我的
      </mt-tab-item>
    </mt-tabbar>

    <!-- 底部栏结束-->
  </div>
</template>

<script>
export default {
  name: "App",
   data(){
    return{
      selected:''
    }
  },
  watch:{
    selected:function(newV,oldV){
      console.log(newV);
      console.log(this.selected);
      // 编程式命名路由
      this.$router.push({name:this.selected});
    }
  }
};
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
</style>
